import { DescItem } from "/@/components/Description";
import { FormSchema } from "/@/components/Form";
import { BasicColumn } from "/@/components/Table";

export const lectureNoteDescSchema: DescItem[] = [
  {
    field: "startDate",
    label: "听课时间",
  },
  {
    field: "className",
    label: "听课班级",
    contentMinWidth: 100,
  },
  {
    field: "lectureContent",
    label: "听课内容",
    span: 2,
  },
  {
    field: "teacherName",
    label: "任课教师",
    contentMinWidth: 100,
  },
  {
    field: "lectureType",
    label: "课程类型",
  },
  {
    field: "teachingProcess",
    label: "教学过程",
    span: 2,
    labelMinWidth: 100,
  },
  {
    field: "experience",
    label: "听课体会与建议",
    span: 2,
  },
  {
    field: "personalSummary",
    label: "个人反思与总结",
    span: 2,
  },
  {
    field: "groupEvaluation",
    label: "小组评价",
    span: 2,
  },
];

export const lectureNoteBasicColumns: BasicColumn[] = [
  {
    title: "Id",
    dataIndex: "noteId",
    defaultHidden: true,
  },
  {
    title: "听课时间",
    dataIndex: "startDate",
    sorter: true,
  },
  {
    title: "听课内容",
    dataIndex: "lectureContent",
  },
  {
    title: "课程类型",
    dataIndex: "lectureType",
  },
];

export const scoreFormSchema: FormSchema[] = [
  {
    field: "schScore",
    component: "InputNumber",
    label: "中学指导教师评分",
    rules: [
      {
        type: "number",
        required: true,
        validator: async (_rule, value) => {
          if (!value) {
            return Promise.reject("评分不能为空");
          }
          if (value < 0 || value > 100 || value % 1 != 0) {
            return Promise.reject("请输入0-100之间的一个整数");
          }
          return Promise.resolve();
        },
        trigger: "change",
      },
    ],
  },
  {
    field: "univScore",
    component: "InputNumber",
    label: "高校指导教师评分",
    rules: [
      {
        type: "number",
        required: true,
        validator: async (_rule, value) => {
          if (!value) {
            return Promise.reject("评分不能为空");
          }
          if (value < 0 || value > 100 || value % 1 != 0) {
            return Promise.reject("请输入0-100之间的一个整数");
          }
          return Promise.resolve();
        },
        trigger: "change",
      },
    ],
  },
];

export const remarkFormSchema: FormSchema[] = [
  {
    field: "groupEvaluation",
    label: "小组评价",
    component: "InputTextArea",
    required: true,
    componentProps: { rows: 5 },
  },
];

export const teachingStudyBasicColumns: BasicColumn[] = [
  {
    title: "Id",
    dataIndex: "studyId",
    defaultHidden: true,
  },
  {
    title: "教研开始时间",
    dataIndex: "startDate",
    width: 150,
    sorter: true,
  },
  {
    title: "教研内容",
    dataIndex: "content",
    width: 150,
  },
  {
    title: "教研方式",
    dataIndex: "type",
    width: 150,
  },
];

export const teachingStudyDescSchema: DescItem[] = [
  {
    field: "startDate",
    label: "教研开始时间",
    labelMinWidth: 100,
    contentMinWidth: 200,
  },
  {
    field: "type",
    label: "教研方式",
    labelMinWidth: 100,
  },
  {
    field: "content",
    label: "教研内容",
    labelMinWidth: 100,
    contentMinWidth: 200,
    span: 2,
  },
  {
    field: "teachingProcess",
    label: "教研过程",
    span: 2,
    labelMinWidth: 100,
  },
  {
    field: "designIdea",
    label: "教研思路",
    span: 2,
    labelMinWidth: 100,
  },
  {
    field: "personalSummary",
    label: "个人反思与总结",
    span: 2,
  },
  {
    field: "groupEvaluation",
    label: "小组评价",
    span: 2,
  },
];

export const lessonPlanBasicColumns: BasicColumn[] = [
  {
    title: "Id",
    dataIndex: "planId",
    defaultHidden: true,
  },
  {
    title: "教案撰写时间",
    dataIndex: "startDate",
    width: 150,
    sorter: true,
  },
  {
    title: "课题名称",
    dataIndex: "subjectName",
    width: 150,
  },
  {
    title: "课程类型",
    dataIndex: "subjectType",
    width: 150,
  },
];

export const lessonPlanDescSchema: DescItem[] = [
  {
    field: "startDate",
    label: "听课时间",
    labelMinWidth: 100,
    contentMinWidth: 200,
  },
  {
    field: "subjectType",
    label: "课程类型",
    labelMinWidth: 100,
  },
  {
    field: "subjectName",
    label: "课题名称",
    labelMinWidth: 100,
    contentMinWidth: 200,
    span: 2,
  },
  {
    field: "teachingProcess",
    label: "教学过程",
    span: 2,
    labelMinWidth: 100,
  },
  {
    field: "designIdea",
    label: "课程设计思路",
    span: 2,
    labelMinWidth: 100,
  },
  {
    field: "personalSummary",
    label: "个人反思与总结",
    span: 2,
  },
  {
    field: "groupEvaluation",
    label: "小组评价",
    span: 2,
  },
];

export const teachingRecordBasicColumns: BasicColumn[] = [
  {
    title: "课堂教学主键",
    dataIndex: "recordId",
    ifShow: false,
  },
  {
    title: "讲试时间",
    dataIndex: "lessonDate",
    sorter: true,
  },
  {
    title: "讲试地点",
    dataIndex: "place",
  },
  {
    title: "中学指导教师分数",
    dataIndex: "schScore",
    defaultHidden: true,
  },
  {
    title: "高校指导教师分数",
    dataIndex: "univScore",
    defaultHidden: true,
  },
];

export const teachingRecordDescSchema: DescItem[] = [
  {
    field: "lessonDate",
    label: "讲试时间",
  },
  {
    field: "place",
    label: "讲试地点",
  },
  {
    field: "schScore",
    label: "中学指导教师分数",
  },
  {
    field: "univScore",
    label: "高校指导教师分数",
  },
];
